from django import forms


class PostForm(forms.Form):
    title = forms.CharField(
        label='标题',
        max_length=30,
        min_length=3,
        error_messages={
            'min_length':'长度小于2',
            'max_length':'长度大于30'
        }
    )

    desc = forms.CharField(
        label='简介',
        max_length=60,
        min_length=2,
        error_messages={
            'min_length': '长度小于2',
            'max_length': '长度大于60'
        }
    )

    content = forms.CharField(
        label='内容',
        widget=forms.Textarea,
    )

    image_path = forms.FileField(
        label='封面图'
    )

